home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 2
/
Atari Mega Archive CD - Volume 2.iso
/
minix
/
up1510b.tgz
/
up1510b
/
src
/
kernel
/
stvdu.c.D
< prev
next >
Wrap
Text File
|
1990-07-25
|
9KB
|
344 lines
*** /tmp/,RCSt1022350 Wed Jul 25 13:56:17 1990
--- stvdu.c Mon Jul 23 22:35:32 1990
***************
*** 1,2 ****
! #ifdef ATARI_ST
/*
--- 1,7 ----
! #if (CHIP == M68000)
!
! /* This driver does not deal with multiple consoles and parameter passing
! through tp. Also the tty struct fields row and column are not maintained
! */
!
/*
***************
*** 4,8 ****
*/
! #include "../h/const.h"
! #include "../h/type.h"
! #include "../h/sgtty.h"
--- 9,12 ----
*/
! #include "kernel.h"
! #include <sgtty.h>
***************
*** 12,14 ****
- #include "const.h"
#include "tty.h"
--- 16,17 ----
***************
*** 45,53 ****
- EXTERN char font16[];
- EXTERN char font8[];
-
/*===========================================================================*
! * start *
*===========================================================================*/
! PRIVATE int start(tp)
register struct tty_struct *tp;
--- 48,53 ----
/*===========================================================================*
! * flush *
*===========================================================================*/
! EXTERN void flush(tp)
register struct tty_struct *tp;
***************
*** 54,58 ****
{
! if (tp->tty_outleft == 0)
! return(1);
vducursor(0);
do {
--- 54,61 ----
{
! register char *rq;
!
! if (tp->tty_rwords == 0)
! return;
vducursor(0);
+ rq = (char *)tp->tty_ramqueue;
do {
***************
*** 60,65 ****
vducursor(1);
! return(0);
}
! vduput(*((char *)tp->tty_phys));
! /* write 1 byte to terminal */
tp->tty_phys++; /* advance physical data pointer */
--- 63,67 ----
vducursor(1);
! return;
}
! out_char(tp, *rq++); /* write 1 byte to terminal */
tp->tty_phys++; /* advance physical data pointer */
***************
*** 66,70 ****
tp->tty_cum++; /* number of characters printed */
! } while (--tp->tty_outleft != 0);
vducursor(1);
! return(1);
}
--- 68,72 ----
tp->tty_cum++; /* number of characters printed */
! } while (--tp->tty_rwords != 0);
vducursor(1);
! return;
}
***************
*** 72,81 ****
/*===========================================================================*
! * echo *
*===========================================================================*/
! PRIVATE echo(tp, c)
! register struct tty_struct *tp;
{
vducursor(0);
! vduput(c);
vducursor(1);
}
--- 74,126 ----
/*===========================================================================*
! * console *
*===========================================================================*/
! PRIVATE void console(tp)
! register struct tty_struct *tp; /* tells which terminal is to be used */
{
+ /* Copy as much data as possible to the output queue, then start I/O. On
+ * memory-mapped terminals, such as the IBM console, the I/O will also be
+ * finished, and the counts updated. Keep repeating until all I/O done.
+ */
+
+ int count = 0;
+ char c;
+ #if (CHIP == M68000)
+ char *charptr = (char *)tp->tty_phys;
+
vducursor(0);
! #else
! extern char get_byte();
! unsigned segment, offset, offset1;
!
! /* Loop over the user bytes one at a time, outputting each one. */
! segment = (tp->tty_phys >> 4) & WORD_MASK;
! offset = tp->tty_phys & OFF_MASK;
! offset1 = offset;
! #endif
!
! while (tp->tty_outleft > 0 && tp->tty_inhibited == RUNNING) {
! #if (CHIP == M68000)
! out_char(tp, *charptr++); /* write 1 byte to terminal */
! count++;
! #else
! c = get_byte(segment, offset); /* fetch 1 byte from user space */
! out_char(tp, c); /* write 1 byte to terminal */
! offset++; /* advance one character in user buffer */
! #endif
! tp->tty_outleft--; /* decrement count */
! }
! #if (CHIP == M68000)
vducursor(1);
+ #endif
+ flush(tp); /* clear out the pending characters */
+
+ /* Update terminal data structure. */
+ #if (CHIP != M68000)
+ count = offset - offset1; /* # characters printed */
+ #endif
+ tp->tty_phys += count; /* advance physical data pointer */
+ tp->tty_cum += count; /* number of characters printed */
+
+ /* If all data has been copied to the terminal, send the reply. */
+ if (tp->tty_outleft == 0) finish(tp, tp->tty_cum);
}
***************
*** 83,85 ****
/*===========================================================================*
! * vduput *
*===========================================================================*/
--- 128,130 ----
/*===========================================================================*
! * out_char *
*===========================================================================*/
***************
*** 88,90 ****
*/
! PUBLIC vduput(c)
register c; /* character to be output */
--- 133,136 ----
*/
! PUBLIC void out_char(tp, c)
! struct tty_struct *tp; /* not yet used */
register c; /* character to be output */
***************
*** 153,154 ****
--- 199,201 ----
register i;
+ register struct tty_struct *tp = &tty_struct[CONSOLE];
***************
*** 161,164 ****
do
! if ((tty_struct[CONSOLE].tty_mode & XTABS) == XTABS)
! vduput(' ');
else
--- 208,211 ----
do
! if ((tp->tty_mode & XTABS) == XTABS)
! out_char(tp, ' ');
else
***************
*** 168,171 ****
case 012: /* LF */
! if (tty_struct[CONSOLE].tty_mode & CRMOD)
! vduput('\r');
case 013: /* VT */
--- 215,218 ----
case 012: /* LF */
! if (tp->tty_mode & CRMOD)
! out_char(tp, '\r');
case 013: /* VT */
***************
*** 259,260 ****
--- 306,308 ----
return;
+ #if (CHIP != M68000)
#ifdef NEEDED
***************
*** 265,266 ****
--- 313,315 ----
#endif NEEDED
+ #endif
case 'm': /* SGR: set graphic rendition */
***************
*** 326,329 ****
case 'h': /* SM: set mode */
! if (v->next[0] == '?' && v->next[1] == '5' && v->mono)
! VIDEO->vd_rgb[0] = c == 'l' ? RGB_BLACK : RGB_WHITE;
return;
--- 375,382 ----
case 'h': /* SM: set mode */
! if (v->next[0] == '?') { /* DEC private modes */
! if (v->next[1] == '5' && v->mono) /* DECSCNM */
! VIDEO->vd_rgb[0] = c == 'l' ? RGB_BLACK : RGB_WHITE;
! else if (v->next[1] == '1') /* DECCKM */
! app_mode = c == 'l' ? TRUE : FALSE;
! }
return;
***************
*** 362,364 ****
! w = &VIDEO->vd_rgb[j & 0x0F];
j = vduparam();
--- 415,417 ----
! w = (short *)&VIDEO->vd_rgb[j & 0x0F];
j = vduparam();
***************
*** 402,403 ****
--- 455,462 ----
return;
+ case '=': /* DECKPAM: keypad application mode */
+ keypad = TRUE;
+ return;
+ case '>': /* DECKPNM: keypad numeric mode */
+ keypad = FALSE;
+ return;
case 'E': /* NEL: next line */
***************
*** 417,420 ****
case 'c': /* RIS: reset to initial state */
! vduinit(&tty_struct[CONSOLE]);
vducursor(0);
return;
--- 476,481 ----
case 'c': /* RIS: reset to initial state */
! vduinit();
vducursor(0);
+ keypad = FALSE;
+ app_mode = FALSE;
return;
***************
*** 643,646 ****
{
! register char *vp; /* ptr into video memory */
! register char *fp; /* ptr into font */
register nl; /* scan lines per char */
--- 704,707 ----
{
! register unsigned char *vp; /* ptr into video memory */
! register unsigned char *fp; /* ptr into font */
register nl; /* scan lines per char */
***************
*** 657,659 ****
nl = v->linc;
! vp = v->curs;
if ((v->attr & 1) == 0) {
--- 718,720 ----
nl = v->linc;
! vp = (unsigned char *)v->curs;
if ((v->attr & 1) == 0) {
***************
*** 673,675 ****
fp -= nl;
! vp = v->curs + 2;
if ((v->attr & 2) == 0) {
--- 734,736 ----
fp -= nl;
! vp = (unsigned char *)v->curs + 2;
if ((v->attr & 2) == 0) {
***************
*** 695,697 ****
*/
! PUBLIC vducursor(onoff)
int onoff;
--- 756,758 ----
*/
! PUBLIC void vducursor(onoff)
int onoff;
***************
*** 725,727 ****
*===========================================================================*/
! PUBLIC vduinit()
{
--- 786,788 ----
*===========================================================================*/
! PUBLIC void vduinit()
{
***************
*** 7